# 递归实现
def FibonacciRecursive(n):
    if n <= 1:
        return n
    else:
        return FibonacciRecursive(n - 1) + FibonacciRecursive(n - 2)

# 迭代实现
def FibonacciIterative(n):
    if n <= 1:
        return n

    a, b = 0, 1
    for _ in range(2, n + 1):
        c = a + b
        a, b = b, c
    return b

if __name__ == "__main__":
    import time
    n = 30
    print(f"Python Fibonacci({n})")

    # 测试递归实现
    start_time = time.time()
    fib_recursive = FibonacciRecursive(n)
    end_time = time.time()
    print(f"Recursive result: {fib_recursive}")
    print(f"Recursive Execution time: {end_time - start_time} seconds")

    # 测试迭代实现
    start_time = time.time()
    fib_iterative = FibonacciIterative(n)
    end_time = time.time()
    print(f"Iterative result: {fib_iterative}")
    print(f"Iterative Execution time: {end_time - start_time} seconds")